Pass mode and detail to focus-in/out signals
authorMatthias Clasen <mclasen@redhat.com>
Thu, 7 Mar 2019 05:14:26 +0000 (00:14 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 17 Mar 2019 01:24:45 +0000 (21:24 -0400)
This information is useful when maintaining a
'last focus' field.

Update all users.

gtk/gtkcalendar.c
gtk/gtkeventcontrollerkey.c
gtk/gtkspinbutton.c
gtk/gtktreeview.c
gtk/gtktreeviewcolumn.c

index 6b941ced3e2827367085e5f135c7f459f697c0d2..32df686852f350da4b64f49f96c66b535cdda591 100644 (file)
@@ -295,6 +295,8 @@ static gboolean gtk_calendar_key_controller_key_pressed (GtkEventControllerKey *
                                                          GdkModifierType        state,
                                                          GtkWidget             *widget);
 static void     gtk_calendar_key_controller_focus       (GtkEventControllerKey *controller,
+                                                         GdkCrossingMode        mode,
+                                                         GdkNotifyType          detail,
                                                          GtkWidget             *widget);
 static void     gtk_calendar_grab_notify    (GtkWidget        *widget,
                                              gboolean          was_grabbed);
@@ -2854,6 +2856,8 @@ gtk_calendar_key_controller_key_pressed (GtkEventControllerKey *controller,
 
 static void
 gtk_calendar_key_controller_focus (GtkEventControllerKey *key,
+                                   GdkCrossingMode        mode,
+                                   GdkNotifyType          detail,
                                    GtkWidget             *widget)
 {
   GtkCalendar *calendar = GTK_CALENDAR (widget);
index f1b28d999b3ff28842a7bd94dd767394f82f568a..2c5a69f7a70e1f651e34ef7268b4281ab39ab3ff 100644 (file)
@@ -93,11 +93,16 @@ gtk_event_controller_key_handle_event (GtkEventController *controller,
   if (event_type == GDK_FOCUS_CHANGE)
     {
       gboolean focus_in;
+      GdkCrossingMode mode;
+      GdkNotifyType detail;
+
+      gdk_event_get_crossing_mode (event, &mode);
+      gdk_event_get_crossing_detail (event, &detail);
 
       if (gdk_event_get_focus_in (event, &focus_in) && focus_in)
-        g_signal_emit (controller, signals[FOCUS_IN], 0);
+        g_signal_emit (controller, signals[FOCUS_IN], 0, mode, detail);
       else
-        g_signal_emit (controller, signals[FOCUS_OUT], 0);
+        g_signal_emit (controller, signals[FOCUS_OUT], 0, mode, detail);
 
       return FALSE;
     }
@@ -233,12 +238,14 @@ gtk_event_controller_key_class_init (GtkEventControllerKeyClass *klass)
                   GTK_TYPE_EVENT_CONTROLLER_KEY,
                   G_SIGNAL_RUN_LAST,
                   0, NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
+                  NULL,
                   G_TYPE_NONE, 0);
 
   /**
    * GtkEventControllerKey::focus-in:
    * @controller: the object which received the signal.
+   * @mode: crossing mode indicating what caused this change
+   * @detail: detail indication where the focus is coming from
    *
    * This signal is emitted whenever the #GtkEventController:widget controlled
    * by the @controller is given the keyboard focus.
@@ -248,12 +255,17 @@ gtk_event_controller_key_class_init (GtkEventControllerKeyClass *klass)
                   GTK_TYPE_EVENT_CONTROLLER_KEY,
                   G_SIGNAL_RUN_LAST,
                   0, NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE, 0);
+                  NULL,
+                  G_TYPE_NONE,
+                  2,
+                  GDK_TYPE_CROSSING_MODE,
+                  GDK_TYPE_NOTIFY_TYPE);
 
   /**
    * GtkEventControllerKey::focus-out:
    * @controller: the object which received the signal.
+   * @mode: crossing mode indicating what caused this change
+   * @detail: detail indication where the focus is going
    *
    * This signal is emitted whenever the #GtkEventController:widget controlled
    * by the @controller loses the keyboard focus.
@@ -263,8 +275,11 @@ gtk_event_controller_key_class_init (GtkEventControllerKeyClass *klass)
                   GTK_TYPE_EVENT_CONTROLLER_KEY,
                   G_SIGNAL_RUN_LAST,
                   0, NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE, 0);
+                  NULL,
+                  G_TYPE_NONE,
+                  2,
+                  GDK_TYPE_CROSSING_MODE,
+                  GDK_TYPE_NOTIFY_TYPE);
 }
 
 static void
@@ -283,8 +298,7 @@ gtk_event_controller_key_init (GtkEventControllerKey *controller)
 GtkEventController *
 gtk_event_controller_key_new (void)
 {
-  return g_object_new (GTK_TYPE_EVENT_CONTROLLER_KEY,
-                       NULL);
+  return g_object_new (GTK_TYPE_EVENT_CONTROLLER_KEY, NULL);
 }
 
 /**
index 8e16faa8370fff50ab106a440fd0c0ef4fcdeba3..b273b2e30dde0374fa794b61526b5960243846e3 100644 (file)
@@ -824,6 +824,8 @@ key_controller_key_released (GtkEventControllerKey *key,
 
 static void
 key_controller_focus_out (GtkEventControllerKey *key,
+                          GdkCrossingMode        mode,
+                          GdkNotifyType          detail,
                           GtkSpinButton         *spin_button)
 {
   GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
index 29da6f8876897e654614635fbe09c5f946b68faa..6a45c7893dc79f4210c013fd60e44f09ce7ddc5f 100644 (file)
@@ -614,6 +614,8 @@ static void     gtk_tree_view_key_controller_key_released (GtkEventControllerKey
                                                            GdkModifierType        state,
                                                            GtkTreeView           *tree_view);
 static void     gtk_tree_view_key_controller_focus_out    (GtkEventControllerKey *key,
+                                                           GdkCrossingMode        mode,
+                                                           GdkNotifyType          detail,
                                                            GtkTreeView           *tree_view);
 
 static gint     gtk_tree_view_focus                (GtkWidget        *widget,
@@ -5475,6 +5477,8 @@ gtk_tree_view_motion_controller_leave (GtkEventControllerMotion *controller,
 
 static void
 gtk_tree_view_key_controller_focus_out (GtkEventControllerKey *key,
+                                        GdkCrossingMode        mode,
+                                        GdkNotifyType          detail,
                                         GtkTreeView           *tree_view)
 {
   gtk_widget_queue_draw (GTK_WIDGET (tree_view));
index 8c113ad3c4c11b1af7b86b8f46e81e94b0c8d4b7..78e22c5ef2ffdc8af9f7c6dad95f2c1b6128fee2 100644 (file)
@@ -814,6 +814,8 @@ gtk_tree_view_column_cell_layout_get_area (GtkCellLayout   *cell_layout)
 
 static void
 focus_in (GtkEventControllerKey *controller,
+          GdkCrossingMode        mode,
+          GdkNotifyType          detail,
           GtkTreeViewColumn     *column)
 {
   _gtk_tree_view_set_focus_column (GTK_TREE_VIEW (column->priv->tree_view), column);